<template>
	<view >
		<uni-popup ref="popup"  type="center"  @change="popChange">
			<view class="tip-view">
				<view class="title-view">邀请您加入<text class="title">《{{dataSource.title}}》</text></view>
				<view class="content-view">
					<image class="head-image" :src="dataSource.avatar"></image>
					<view class="name-view">
						<view class="name-item">
							<text class="name">{{dataSource.name}}</text>
							<text class="gener">{{dataSource.gender=='1'?'男':'女'}}</text>
						</view>
						<text class="address">{{dataSource.ancestral}}</text>
					</view>
				</view>
				<view class="btn-view">
					<text class="left-btn" @click="leftClick">取消</text>
					<text class="right-btn" @click="rightClick">同意</text>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		name: "invite-dialog",
		props: {
			isShow:false,
			dataSource:Object,
		},
		watch: {
			isShow(val) {
				if(val){
					this.$refs.popup.open();
				}
			}
		},
		data() {
			return {
			};
		},
		methods:{
			popChange(e) {
				if(!e.show){
					var obj = {
						isclose: false,
					};
					this.$emit('returnInviteDialog', obj);
				}
			},
			leftClick(){
				var obj = {
					isclose: false,
					tag:"cancle"
				};
				this.$emit('returnInviteDialog', obj);
				this.$refs.popup.close();
			},
			rightClick(){
				var obj = {
					isclose: false,
					tag:"sure"
				};
				this.$emit('returnInviteDialog', obj);
				this.$refs.popup.close();
			}
		}
	}
</script>

<style>
	@import "invite-dialog.css";
</style>
